/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.Cloudtap.Backend;
import java.util.*;

/**
 *
 * @author Dharshan
 */
public abstract class BaseVMType implements iVMType {

    protected UUID id;
    protected HashMap<UUID,String> properties;
    protected HashMap<UUID,String> operations;

    public BaseVMType(UUID id)
    {
        this.id = id;
        Init();
    }

    private void Init()
    {
        this.properties = new HashMap<UUID,String>();
        this.operations = new HashMap<UUID,String>();

        //TODO Support localization
        //Add the properties of the base VM type
        this.AddProperty(BaseVMTypePropertyID.Name,"Name");
        this.AddProperty(BaseVMTypePropertyID.Description,"Description");
        this.AddProperty(BaseVMTypePropertyID.CreationTime,"CreationTime");
        this.AddProperty(BaseVMTypePropertyID.State,"State");
        this.AddProperty(BaseVMTypePropertyID.OperatingSystem,"Operating System");

        //Add the operations of the base VM Type
        this.AddOperation(BaseVMTypeOperationID.Start,"Start");
        this.AddOperation(BaseVMTypeOperationID.Stop,"Stop");
    }

    public UUID GetID()
    {
        return this.id;
    }

    public HashMap<UUID,String> GetSupportedProperties()
    {
        return this.properties;
    }

    public HashMap<UUID,String> GetSupportedOperations()
    {
        return this.operations;
    }

    protected void AddProperty(UUID propertyID, String propertyName)
    {
        this.properties.put(propertyID,propertyName);
    }

    protected void AddOperation(UUID operationID, String operationName)
    {
        this.operations.put(operationID,operationName);
    }

}
